<@t.header> </@t.header> <@t.body> <#setting url_escaping_charset='utf-8'>
<div class="container" style="margin-top: 50px;">
	<div class="row">
		<div class="col-md-6">
			<div class="form-group has-success text-success">
				<div class="input-group">
					<span class="input-group-addon btn btn-for-search">
						<i class="icon-search icon-2x" style="margin: 0 20px;" style="border: none; background-color: none;"></i>
					</span>
					<input type="text" class="form-control input-lg" name="key" value="${search.name!''}" style="height: 50px; font-weight: bold;" placeholder="输入软件名称筛选" />
				</div>
			</div>
		</div>
	</div>

	<div class="soft-list-container">
		<table class="soft-list" data-page="${page}" data-page-size="${pageSize}" data-count="${count}">
			<tr class="title-row">
				<th class="text-center" width="40"></th>
				<th class="text-center">名称</th>
				<th class="text-center">版本</th>
				<th class="text-center">上传时间</th>
			</tr>
			<#if data??> <#list data as d>
			<tr data-id="${d.id}">
				<td class="text-center">
					<i class="icon-download icon-large text-danger download-software" style="cursor: pointer;" data-path="${d.pathForUrl!''}" data-filename="${((d.name)?url)?url}"></i>
				</td>
				<td class="text-center">${d.name}</td>
				<td class="text-center">${d.version}</td>
				<td class="text-center">${d.upTime}</td>
			</tr>
			</#list> </#if>
		</table>
	</div>
</div>

</@t.body> <@t.foot>

<script src="${request.contextPath}/core/js/jquery.form.js"></script>
<script src="${request.contextPath}/js/suredy-list.js"></script>
<script src="${request.contextPath}/js/suredy-modal.js"></script>
<script src="${request.contextPath}/app/js/form-checker.js"></script>
<script type="text/javascript">
	$(function() {
		var initList = function() {
			$('.soft-list').list({
				header : false,
				search : false,
				paginate : function(page, pageSize, key) {
					doSearch(page, pageSize);
				}
			});
		};

		var doSearch = function(page, pageSize) {
			$.suredy.loadContent('${request.contextPath}/software/index .soft-list-container>*', '.soft-list-container', {
				page : page,
				pageSize : pageSize,
				name : $('[name="key"]').val()
			}, function() {
				initList();
			});
		};

		initList();

		$('.btn-for-search').on('click', function(event) {
			doSearch();
		});

		$('[name="key"]').on('keypress', function(event) {
			if (event.keyCode === 13) {
				doSearch(1, $('.soft-list').data('page-size'));
				return false;
			}
			return true;
		});

		$('.download-software').on('click', function() {
			var $this = $(this);
			window.open('${request.contextPath}/download/' + $this.data('path') + '/' + $this.data('filename'), '_blank');
		});
	});
</script>
</@t.foot>
